package IC.AST.nodes;

import IC.AST.*;

/**
 * a primitive type - int, boolean, or string
 */
public class PrimitiveTypeDecl extends TypeDecl {
	private int kind;	// the primitive type kind, from sym

	/**
	 * @param kind the primitive type kind, from sym
	 * @param fileName TODO
	 * @param line the node line number
	 * @param column the node column number
	 */
	public PrimitiveTypeDecl(int kind, String fileName, int line, int column) {
		super(fileName, line,column);
		this.kind = kind;
	}

	/**
	 * @return the primitive type kind, from sym
	 */
	public int getKind() {
		return this.kind;
	}

	public <D,U> U accept(PropogatingVisitor<D,U> v, D context) throws Exception {
		return v.visit(this,context);
	}

	public String toString() {
		switch(this.kind) {
		case IC.Parser.sym.INT:
			return "int";
		case IC.Parser.sym.STRING:
			return "string";
		case  IC.Parser.sym.BOOLEAN:
			return "boolean";
		}

		return null;
	}
}
